def min_operations_to_sum(arr, target_sum):
    current_sum = sum(arr)
    diff = abs(current_sum - target_sum)
    
    if diff == 0:
        return 0
    
    # 对数组进行排序，方便之后贪心地修改
    arr.sort(reverse=True)  # 从大到小排序
    
    operations = 0
    for num in arr:
        max_change = abs(num - (-10000))  # 假设修改为最小值-10000
        if diff <= max_change:
            operations += 1
            break  # 只需要一次修改就能使diff为0
        else:
            operations += 1
            diff -= max_change
    
    return operations
t = int(input())
for i in range(0,t):
    n = int(input())
    sum_ = int(input())
    arr = list()
    for j in range(0,n):
        tmp = int(input())
        arr.append(tmp)
    print(min_operations_to_sum(arr,sum_))
        